package day0303;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        //get()、set()、重载remove()、重载add()、subList()
        List<String> list =new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        System.out.println(list.get(1));
        list.set(3,"哈哈");
        System.out.println(list);

        list.remove(3);//删除第三个
        list.remove("one");//删除该元素
        list.add(3,"six");
        System.out.println(list);
        List<String> list1=list.subList(1,4);
        System.out.println(list1);



    }
}
